<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>hello bootstrap</title>
    <!--导入bootstrap的主样式-->
    <link rel="stylesheet" href="css/bootstrap.min.css" type="text/css">

    <style type="text/css">
        .row+.row {
            margin-top: 100px;
        }
    </style>
</head>
<body>
<div class="container">
    <div class="row">
        <div class="col-md-6">
            <div class="dropdown pull-right">
                <!--下拉按钮定义-->
                <button class="btn btn-primary dropdown-toggle" type="button" data-toggle="dropdown">
                    下拉菜单<span class="caret"></span>
                </button>
                <!-- 定义下拉菜单项 -->
                <ul class="dropdown-menu dropdown-menu-right">
                    <li><a href="#">子菜单1</a></li>
                    <li><a href="#">子菜单2</a></li>
                    <li><a href="#">子菜单3</a></li>
                    <li role="separator" class="divider"></li>
                    <li><a href="#">子菜单4</a></li>
                </ul>
            </div>
        </div>
    </div>

    <div class="row">
        <div class="col-md-6">
            <div class="dropup">
                <!--下拉按钮定义-->
                <button class="btn btn-primary dropdown-toggle" type="button" data-toggle="dropdown">
                    上拉菜单<span class="caret"></span>
                </button>
                <!-- 定义下拉菜单项 -->
                <ul class="dropdown-menu">
                    <li><a href="#">子菜单1</a></li>
                    <li><a href="#">子菜单2</a></li>
                    <li><a href="#">子菜单3</a></li>
                    <li role="separator" class="divider"></li>
                    <li><a href="#">子菜单4</a></li>
                </ul>
            </div>
        </div>
    </div>

</div>

<!-- 导入js文件 -->
<script type="text/javascript" src="js/jquery-3.2.1.min.js"></script>
<script type="text/javascript" src="js/bootstrap.min.js"></script>
</body>
</html>